package chpt7;

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) {
		Set<String> str = new TreeSet<String>();
		Scanner input = new Scanner(System.in);
		int n = 10;
		while (input.hasNext()) {
			String word = input.next();
			if (word.equals("!!!!!"))
				break;
			else if (!str.contains(word))
				str.add(word);
		}
		System.out.println(str.size());
		str.toArray();
		if (str.size() <= 10)
			for (String words : str) {
				System.out.println(words);
			}
		else
			for (String words : str) {
				if (n-- <= 0)
					break;
				System.out.println(words);
			}

	}

}
